package com.github.wujichen158.andemusic.newcommands;

import com.github.wujichen158.andemusic.aboutconfig.AndeMusicConfig;
import net.minecraft.client.resources.I18n;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;

public abstract class CommandsRoot extends CommandBase {

    @Override
    public String getUsage(ICommandSender sender) {
        return null;
    }

    @Override
    public int getRequiredPermissionLevel() {
        return 0;
    }

    @Override
    public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
        return !AndeMusicConfig.isOpCommands || sender.canUseCommand(getRequiredPermissionLevel(), getName());
    }

    public static void send(ICommandSender sender, TextFormatting color, String mes, Object... obj) {
        sender.sendMessage(new TextComponentTranslation(mes, obj).setStyle(new Style().setColor(color)));
    }

}
